package com.lengxf.pay.wx.config;


import com.lengxf.pay.common.config.TransactionType;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

@Getter
@AllArgsConstructor
public enum WX_TransactionType implements TransactionType {

    JSAPI(),
    APP(),
    H5(),
    NATIVE(),
    QUERY(),
    REFUND(),
    REFUND_QUERY(),

    ;

    public static WX_TransactionType toEnum(String payWay) {
        return Arrays.stream(WX_TransactionType.values())
                .filter(e -> e.toString().equalsIgnoreCase(payWay))
                .findFirst()
                .orElseThrow(() -> new RuntimeException("未找到匹配的微信交易类型"));
    }

}
